package com.yeyv.net.Security;

import com.alibaba.fastjson2.JSONObject;
import com.yeyv.net.UsefulEntity.Constant;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.PrintWriter;

@Component
public class AccessDeniedPoint implements AccessDeniedHandler {
    @Override
    public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, IOException {
//        JSONObject result = JSONObject.from(Constant.ResponseAuthReject());
//        httpServletResponse.setContentType("application/json;charset=utf-8");
//        PrintWriter out = httpServletResponse.getWriter();
//        out.write(JSONObject.toJSONString(result));
//        out.flush();
//        out.close();
    }
}